﻿using System;
using System.Windows.Forms;
using YJKRevitBase.WinForm.WinFormRemindSuit;

namespace YJKCopyModel.Models
{
	public class ComboBoxControlInfoTransform : ICustomControlInfoTransform
	{
		public string GetControlStr(System.Windows.Forms.Control inputControl)
		{
			System.Windows.Forms.ComboBox comboBox = inputControl as System.Windows.Forms.ComboBox;
			bool flag = comboBox == null;
			string result;
			if (flag)
			{
				result = "";
			}
			else
			{
				result = comboBox.SelectedIndex.ToString();
			}
			return result;
		}

		public void SetControlStr(ref System.Windows.Forms.Control inputControl, string inputStr)
		{
			System.Windows.Forms.ComboBox comboBox = inputControl as System.Windows.Forms.ComboBox;
			bool flag = comboBox == null;
			if (!flag)
			{
				int num = -1;
				bool flag2 = int.TryParse(inputStr, out num);
				if (flag2)
				{
					bool flag3 = num >= 0 && comboBox.Items.Count > 0 && comboBox.Items.Count > num;
					if (flag3)
					{
						comboBox.SelectedIndex = num;
					}
				}
			}
		}
	}
}
